package example

object StringTest {
  def main(args: Array[String]): Unit = {
    var s: String = "abc ";
    var i: Int = 24;
    println(s + "123")
    println(s + i)

    //多次拼接
    println(s * 20)

    printf("女孩%d岁", 10)
    printf("女孩%d岁%s", 18, "上大学\n")

    var name = "谷爱凌"
    var s1 = s"女孩${name}18岁上大学"
    println(s1)

    var age = 10.887
    //
    println(f"hg${age}%2.2fasdf")
    // 原始输出
    println(raw"hg${age}%2.2fasdf")

    // 多行字符，|开头表示开始
    var sql = s"""
    |select *
    |from
    |  student
    |where
    |  name = 'zhang'
    """.stripMargin

    println(sql)

    // 字符串指针相等 eq
    var s3: String = "hello"
    var s4: String = new String("hello")
    println(s3 == s4)
    println(s3.equals(s4))
    println(s3.eq(s4))

  }
}
